package com.jjyu.service;


import com.jjyu.dao.PreferenceMapper;
import com.jjyu.entity.Preference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PreferenceService {

    @Autowired
    private PreferenceMapper preferenceMapper;

    @Transactional
    public boolean addPreference(Preference preference) {
        return preferenceMapper.insert(preference) > 0;
    }

    @Transactional
    public boolean updatePreference(Preference preference) {
        return preferenceMapper.updateById(preference) > 0;
    }

    @Transactional
    public boolean deletePreference(int prefId) {
        return preferenceMapper.deleteById(prefId) > 0;
    }
}